﻿namespace HRM.CORE.REPORT
{
    using DevExpress.Utils;
    using DevExpress.XtraPrinting;
    using DevExpress.XtraReports.UI;
    using Dictionary.ERP;
    using HRM.CORE;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Printing;

    public class rptReportRate2 : XtraReport
    {
        private BottomMarginBand BottomMargin;
        private IContainer components;
        private DetailBand Detail;
        private XRLabel dtDate;
        private GroupHeaderBand GroupHeader1;
        private HRM_PROCESS_RATE l_Rate;
        private string m_Code;
        private int m_Level;
        private int m_Month;
        private int m_Order;
        private int m_Year;
        private ReportFooterBand ReportFooter;
        private ReportHeaderBand ReportHeader;
        private TopMarginBand TopMargin;
        private XRLabel txtCompany;
        private XRTableCell txtOrder;
        private XRLabel txtTitle;
        private XRTable xrTable1;
        private XRTable xrTable2;
        private XRTable xrTable3;
        private XRTableCell xrTableCell1;
        private XRTableCell xrTableCell10;
        private XRTableCell xrTableCell11;
        private XRTableCell xrTableCell12;
        private XRTableCell xrTableCell13;
        private XRTableCell xrTableCell15;
        private XRTableCell xrTableCell16;
        private XRTableCell xrTableCell18;
        private XRTableCell xrTableCell2;
        private XRTableCell xrTableCell20;
        private XRTableCell xrTableCell22;
        private XRTableCell xrTableCell23;
        private XRTableCell xrTableCell26;
        private XRTableCell xrTableCell5;
        private XRTableCell xrTableCell7;
        private XRTableCell xrTableCell8;
        private XRTableCell xrTableCell9;
        private XRTableRow xrTableRow1;
        private XRTableRow xrTableRow2;
        private XRTableRow xrTableRow3;

        public rptReportRate2()
        {
            this.components = null;
            this.l_Rate = new HRM_PROCESS_RATE();
            this.m_Month = 0;
            this.m_Year = 0;
            this.m_Level = 0;
            this.m_Code = "";
            this.m_Order = 0;
            this.InitializeComponent();
        }

        public rptReportRate2(int Level, string Code, int Month, int Year)
        {
            this.components = null;
            this.l_Rate = new HRM_PROCESS_RATE();
            this.m_Month = 0;
            this.m_Year = 0;
            this.m_Level = 0;
            this.m_Code = "";
            this.m_Order = 0;
            this.InitializeComponent();
            this.m_Level = Level;
            this.m_Code = Code;
            this.m_Month = Month;
            this.m_Year = Year;
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            this.Detail = new DetailBand();
            this.xrTable2 = new XRTable();
            this.xrTableRow2 = new XRTableRow();
            this.txtOrder = new XRTableCell();
            this.xrTableCell12 = new XRTableCell();
            this.xrTableCell16 = new XRTableCell();
            this.xrTableCell20 = new XRTableCell();
            this.xrTableCell5 = new XRTableCell();
            this.xrTableCell26 = new XRTableCell();
            this.xrTableCell18 = new XRTableCell();
            this.TopMargin = new TopMarginBand();
            this.BottomMargin = new BottomMarginBand();
            this.ReportHeader = new ReportHeaderBand();
            this.dtDate = new XRLabel();
            this.txtTitle = new XRLabel();
            this.txtCompany = new XRLabel();
            this.ReportFooter = new ReportFooterBand();
            this.xrTable3 = new XRTable();
            this.xrTableRow3 = new XRTableRow();
            this.xrTableCell7 = new XRTableCell();
            this.xrTableCell10 = new XRTableCell();
            this.xrTableCell8 = new XRTableCell();
            this.xrTableCell9 = new XRTableCell();
            this.xrTable1 = new XRTable();
            this.xrTableRow1 = new XRTableRow();
            this.xrTableCell1 = new XRTableCell();
            this.xrTableCell11 = new XRTableCell();
            this.xrTableCell13 = new XRTableCell();
            this.xrTableCell22 = new XRTableCell();
            this.xrTableCell23 = new XRTableCell();
            this.xrTableCell2 = new XRTableCell();
            this.xrTableCell15 = new XRTableCell();
            this.GroupHeader1 = new GroupHeaderBand();
            this.xrTable2.BeginInit();
            this.xrTable3.BeginInit();
            this.xrTable1.BeginInit();
            this.BeginInit();
            this.Detail.Controls.AddRange(new XRControl[] { this.xrTable2 });
            this.Detail.HeightF = 25f;
            this.Detail.Name = "Detail";
            this.Detail.Padding = new PaddingInfo(0, 0, 0, 0, 100f);
            this.Detail.TextAlignment = TextAlignment.TopLeft;
            this.xrTable2.Borders = BorderSide.Bottom | BorderSide.Right | BorderSide.Left;
            this.xrTable2.Font = new Font("Times New Roman", 10.25f);
            this.xrTable2.LocationFloat = new PointFloat(1.589457E-05f, 0f);
            this.xrTable2.Name = "xrTable2";
            this.xrTable2.Padding = new PaddingInfo(4, 0, 0, 0, 100f);
            this.xrTable2.Rows.AddRange(new XRTableRow[] { this.xrTableRow2 });
            this.xrTable2.SizeF = new SizeF(1039f, 25f);
            this.xrTable2.StylePriority.UseBorders = false;
            this.xrTable2.StylePriority.UseFont = false;
            this.xrTable2.StylePriority.UsePadding = false;
            this.xrTable2.StylePriority.UseTextAlignment = false;
            this.xrTable2.TextAlignment = TextAlignment.MiddleLeft;
            this.xrTableRow2.Cells.AddRange(new XRTableCell[] { this.txtOrder, this.xrTableCell12, this.xrTableCell16, this.xrTableCell20, this.xrTableCell5, this.xrTableCell26, this.xrTableCell18 });
            this.xrTableRow2.Name = "xrTableRow2";
            this.xrTableRow2.Weight = 1.0;
            this.txtOrder.Name = "txtOrder";
            this.txtOrder.Text = "txtOrder";
            this.txtOrder.Weight = 0.15137000220900365;
            this.txtOrder.BeforePrint += new PrintEventHandler(this.txtOrder_BeforePrint);
            this.xrTableCell12.Name = "xrTableCell12";
            this.xrTableCell12.Text = "[EmployeeCode]";
            this.xrTableCell12.Weight = 0.28756905036099978;
            this.xrTableCell16.Name = "xrTableCell16";
            this.xrTableCell16.Text = "[FirstName] [LastName]";
            this.xrTableCell16.Weight = 0.51013903459877374;
            this.xrTableCell20.Name = "xrTableCell20";
            this.xrTableCell20.Text = "[Violation]";
            this.xrTableCell20.Weight = 0.86833857663900826;
            this.xrTableCell5.Name = "xrTableCell5";
            this.xrTableCell5.Text = "[Date!dd/MM/yyyy]";
            this.xrTableCell5.Weight = 0.30634215339315518;
            this.xrTableCell26.Name = "xrTableCell26";
            this.xrTableCell26.Text = "[Minus!#,0]";
            this.xrTableCell26.Weight = 0.26423459241204356;
            this.xrTableCell18.Name = "xrTableCell18";
            this.xrTableCell18.Text = "[Description]";
            this.xrTableCell18.Weight = 0.61200659038701555;
            this.TopMargin.HeightF = 70f;
            this.TopMargin.Name = "TopMargin";
            this.TopMargin.Padding = new PaddingInfo(0, 0, 0, 0, 100f);
            this.TopMargin.TextAlignment = TextAlignment.TopLeft;
            this.BottomMargin.HeightF = 56f;
            this.BottomMargin.Name = "BottomMargin";
            this.BottomMargin.Padding = new PaddingInfo(0, 0, 0, 0, 100f);
            this.BottomMargin.TextAlignment = TextAlignment.TopLeft;
            this.ReportHeader.Controls.AddRange(new XRControl[] { this.dtDate, this.txtTitle, this.txtCompany });
            this.ReportHeader.HeightF = 98f;
            this.ReportHeader.Name = "ReportHeader";
            this.dtDate.Font = new Font("Times New Roman", 11f);
            this.dtDate.LocationFloat = new PointFloat(316.2499f, 68.37502f);
            this.dtDate.Name = "dtDate";
            this.dtDate.Padding = new PaddingInfo(2, 2, 0, 0, 100f);
            this.dtDate.SizeF = new SizeF(721.7502f, 17.99997f);
            this.dtDate.StylePriority.UseFont = false;
            this.dtDate.StylePriority.UseTextAlignment = false;
            this.dtDate.Text = "( Th\x00e1ng ………………./20...…)";
            this.dtDate.TextAlignment = TextAlignment.MiddleCenter;
            this.txtTitle.Font = new Font("Times New Roman", 16f, FontStyle.Bold);
            this.txtTitle.LocationFloat = new PointFloat(317.2499f, 10.00001f);
            this.txtTitle.Multiline = true;
            this.txtTitle.Name = "txtTitle";
            this.txtTitle.Padding = new PaddingInfo(2, 2, 0, 0, 100f);
            this.txtTitle.SizeF = new SizeF(721.7501f, 58.37501f);
            this.txtTitle.StylePriority.UseFont = false;
            this.txtTitle.StylePriority.UseTextAlignment = false;
            this.txtTitle.Text = "DANH S\x00c1CH Đ\x00c1NH GI\x00c1/XẾP LOẠI  CB-CNV";
            this.txtTitle.TextAlignment = TextAlignment.MiddleCenter;
            this.txtCompany.Font = new Font("Times New Roman", 12f, FontStyle.Bold);
            this.txtCompany.LocationFloat = new PointFloat(0f, 10.00001f);
            this.txtCompany.Name = "txtCompany";
            this.txtCompany.Padding = new PaddingInfo(2, 2, 0, 0, 100f);
            this.txtCompany.SizeF = new SizeF(305.9166f, 58.37501f);
            this.txtCompany.StylePriority.UseFont = false;
            this.txtCompany.StylePriority.UseTextAlignment = false;
            this.txtCompany.Text = "txtCompany";
            this.txtCompany.TextAlignment = TextAlignment.MiddleCenter;
            this.ReportFooter.Controls.AddRange(new XRControl[] { this.xrTable3 });
            this.ReportFooter.HeightF = 107f;
            this.ReportFooter.Name = "ReportFooter";
            this.xrTable3.Font = new Font("Times New Roman", 11f, FontStyle.Bold);
            this.xrTable3.LocationFloat = new PointFloat(1.589457E-05f, 28.125f);
            this.xrTable3.Name = "xrTable3";
            this.xrTable3.Rows.AddRange(new XRTableRow[] { this.xrTableRow3 });
            this.xrTable3.SizeF = new SizeF(1039f, 29.16667f);
            this.xrTable3.StylePriority.UseFont = false;
            this.xrTable3.StylePriority.UseTextAlignment = false;
            this.xrTable3.TextAlignment = TextAlignment.MiddleCenter;
            this.xrTableRow3.Cells.AddRange(new XRTableCell[] { this.xrTableCell7, this.xrTableCell10, this.xrTableCell8, this.xrTableCell9 });
            this.xrTableRow3.Name = "xrTableRow3";
            this.xrTableRow3.Weight = 1.0;
            this.xrTableCell7.Name = "xrTableCell7";
            this.xrTableCell7.Text = "GI\x00c1M ĐỐC (Duyệt)";
            this.xrTableCell7.Weight = 0.68046198267564972;
            this.xrTableCell10.Name = "xrTableCell10";
            this.xrTableCell10.Text = "T. BAN H\x00c0NH CH\x00cdNH";
            this.xrTableCell10.Weight = 0.78272374348645035;
            this.xrTableCell8.Name = "xrTableCell8";
            this.xrTableCell8.Text = "TRƯỞNG BỘ PHẬN";
            this.xrTableCell8.Weight = 0.85262269946218572;
            this.xrTableCell9.Name = "xrTableCell9";
            this.xrTableCell9.Text = "NGƯỜI LẬP";
            this.xrTableCell9.Weight = 0.68419157437571432;
            this.xrTableCell9.BeforePrint += new PrintEventHandler(this.rptReportRate2_BeforePrint);
            this.xrTable1.AnchorVertical = VerticalAnchorStyles.Bottom;
            this.xrTable1.Borders = BorderSide.All;
            this.xrTable1.Font = new Font("Times New Roman", 10.25f, FontStyle.Bold);
            this.xrTable1.LocationFloat = new PointFloat(1.589457E-05f, 0f);
            this.xrTable1.Name = "xrTable1";
            this.xrTable1.Rows.AddRange(new XRTableRow[] { this.xrTableRow1 });
            this.xrTable1.SizeF = new SizeF(1039f, 24.95832f);
            this.xrTable1.StylePriority.UseBorders = false;
            this.xrTable1.StylePriority.UseFont = false;
            this.xrTable1.StylePriority.UseTextAlignment = false;
            this.xrTable1.TextAlignment = TextAlignment.MiddleCenter;
            this.xrTableRow1.Cells.AddRange(new XRTableCell[] { this.xrTableCell1, this.xrTableCell11, this.xrTableCell13, this.xrTableCell22, this.xrTableCell23, this.xrTableCell2, this.xrTableCell15 });
            this.xrTableRow1.Name = "xrTableRow1";
            this.xrTableRow1.Weight = 1.0;
            this.xrTableCell1.CanGrow = false;
            this.xrTableCell1.Name = "xrTableCell1";
            this.xrTableCell1.Text = "STT";
            this.xrTableCell1.Weight = 0.15137000241443954;
            this.xrTableCell11.CanGrow = false;
            this.xrTableCell11.Name = "xrTableCell11";
            this.xrTableCell11.Text = "MSNV";
            this.xrTableCell11.Weight = 0.2875690702645789;
            this.xrTableCell13.CanGrow = false;
            this.xrTableCell13.Name = "xrTableCell13";
            this.xrTableCell13.Text = "T\x00ean nh\x00e2n vi\x00ean";
            this.xrTableCell13.Weight = 0.510139098560454;
            this.xrTableCell22.CanGrow = false;
            this.xrTableCell22.Name = "xrTableCell22";
            this.xrTableCell22.Padding = new PaddingInfo(0, 0, 0, 4, 100f);
            this.xrTableCell22.StylePriority.UsePadding = false;
            this.xrTableCell22.StylePriority.UseTextAlignment = false;
            this.xrTableCell22.Text = "Nội dung vi phạm";
            this.xrTableCell22.TextAlignment = TextAlignment.MiddleCenter;
            this.xrTableCell22.Weight = 0.86833872483731311;
            this.xrTableCell23.CanGrow = false;
            this.xrTableCell23.Name = "xrTableCell23";
            this.xrTableCell23.Padding = new PaddingInfo(0, 0, 0, 4, 100f);
            this.xrTableCell23.StylePriority.UsePadding = false;
            this.xrTableCell23.StylePriority.UseTextAlignment = false;
            this.xrTableCell23.Text = "Ng\x00e0y vi phạm";
            this.xrTableCell23.TextAlignment = TextAlignment.MiddleCenter;
            this.xrTableCell23.Weight = 0.30634216140515569;
            this.xrTableCell2.CanGrow = false;
            this.xrTableCell2.Name = "xrTableCell2";
            this.xrTableCell2.Padding = new PaddingInfo(0, 0, 0, 4, 100f);
            this.xrTableCell2.StylePriority.UsePadding = false;
            this.xrTableCell2.StylePriority.UseTextAlignment = false;
            this.xrTableCell2.Text = "Điểm trừ";
            this.xrTableCell2.TextAlignment = TextAlignment.MiddleCenter;
            this.xrTableCell2.Weight = 0.26423440216258859;
            this.xrTableCell15.CanGrow = false;
            this.xrTableCell15.Name = "xrTableCell15";
            this.xrTableCell15.Text = "Ghi ch\x00fa";
            this.xrTableCell15.Weight = 0.61200654035547031;
            this.GroupHeader1.Controls.AddRange(new XRControl[] { this.xrTable1 });
            this.GroupHeader1.HeightF = 24.95832f;
            this.GroupHeader1.Name = "GroupHeader1";
            base.Bands.AddRange(new Band[] { this.Detail, this.TopMargin, this.BottomMargin, this.ReportHeader, this.ReportFooter, this.GroupHeader1 });
            base.Landscape = true;
            base.Margins = new Margins(0x47, 0x3b, 70, 0x38);
            base.PageHeight = 0x33b;
            base.PageWidth = 0x491;
            base.PaperKind = PaperKind.A4;
            base.Version = "9.3";
            this.BeforePrint += new PrintEventHandler(this.rptReportRate2_BeforePrint);
            this.xrTable2.EndInit();
            this.xrTable3.EndInit();
            this.xrTable1.EndInit();
            this.EndInit();
        }

        private string LoadNameCode()
        {
            string str = "";
            if (this.m_Level == 1)
            {
                HRM_BRANCH hrm_branch = new HRM_BRANCH();
                hrm_branch.Get(this.m_Code);
                return ("Đơn vị: " + hrm_branch.BranchName + ". ");
            }
            if (this.m_Level == 2)
            {
                HRM_DEPARTMENT hrm_department = new HRM_DEPARTMENT();
                hrm_department.Get(this.m_Code);
                return ("Đơn vị: " + hrm_department.DepartmentName + ". ");
            }
            if (this.m_Level == 3)
            {
                HRM_GROUP hrm_group = new HRM_GROUP();
                hrm_group.Get(this.m_Code);
                str = "Đơn vị: " + hrm_group.GroupName + ". ";
            }
            return str;
        }

        private void rptReportRate2_BeforePrint(object sender, PrintEventArgs e)
        {
            //if (MyInfo.Get(MyEncryption.Encrypt("ERP01", "123654", true)) == "OK")
            {
                this.txtCompany.Text = "";//MyInfo.Company.ToUpper();
            }
            this.dtDate.Text = this.LoadNameCode() + "Th\x00e1ng " + this.m_Month.ToString() + " Năm " + this.m_Year.ToString();
            DataSet set = new DataSet();
            DataTable table = new DataTable();
            table = this.l_Rate.ReportRate2(this.m_Level, this.m_Code, this.m_Month, this.m_Year);
            set.Tables.Add(table);
            base.DataSource = set;
            base.DataAdapter = table;
            base.DataMember = table.TableName;
        }

        private void txtOrder_BeforePrint(object sender, PrintEventArgs e)
        {
            this.m_Order++;
            this.txtOrder.Text = this.m_Order.ToString();
        }
    }
}

